package com.foogui.service.impl;

import com.foogui.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public Integer reduce(String userId, Integer money) {
        return jdbcTemplate.update("update t_account set amount = amount - ? where user_id = ?", new Object[] {money, userId});
    }
}
